// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class XAD : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 Street Address",1)]
  	    [HL7Field(HL7Version.v23, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 1, HL7Repeat.False, HL7Required.True,"SAD")]
  	    [HL7Field(HL7Version.v25, 1, HL7Repeat.False, HL7Required.True,"SAD")]
  	    [HL7Field(HL7Version.v251, 1, HL7Repeat.False, HL7Required.True,"SAD")]
  	    [HL7Field(HL7Version.v26, 1, HL7Repeat.False, HL7Required.True,"SAD")]
  	    [HL7Field(HL7Version.v27, 1, HL7Repeat.False, HL7Required.True,"SAD")]
	    public SAD StreetAddress {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 Other Designation",2)]
  	    [HL7Field(HL7Version.v23, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST OtherDesignation {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 City",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST City {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 State or Province",4)]
  	    [HL7Field(HL7Version.v23, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST StateorProvince {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 Zip or Postal Code",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST ZiporPostalCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 Country",6)]
  	    [HL7Field(HL7Version.v23, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 6, HL7Repeat.False, HL7Required.True,"ID")]
		[Countrycode]
	    public ID Country {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 Address Type",7)]
  	    [HL7Field(HL7Version.v23, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 7, HL7Repeat.False, HL7Required.True,"ID")]
		[AddressType]
	    public ID AddressType {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 Other Geographic Designation",8)]
  	    [HL7Field(HL7Version.v23, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 8, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST OtherGeographicDesignation {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 County/Parish Code",9)]
  	    [HL7Field(HL7Version.v23, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v231, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.False, HL7Required.True,"CWE")]
		[CountyParish]
	    public CWE CountyParishCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("10 Census Tract",10)]
  	    [HL7Field(HL7Version.v23, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v231, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v27, 10, HL7Repeat.False, HL7Required.True,"CWE")]
		[CensusTract]
	    public CWE CensusTract {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("11 Address Representation Code",11)]
  	    [HL7Field(HL7Version.v231, 11, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 11, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 11, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 11, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 11, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 11, HL7Repeat.False, HL7Required.True,"ID")]
		[Nameaddressrepresentation]
	    public ID AddressRepresentationCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("12 Address Validity Range",12)]
  	    [HL7Field(HL7Version.v24, 12, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v25, 12, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v251, 12, HL7Repeat.False, HL7Required.True,"DR")]
  	    [HL7Field(HL7Version.v26, 12, HL7Repeat.False, HL7Required.True,"DR")]
	    public DR AddressValidityRange {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("13 Effective Date",13)]
  	    [HL7Field(HL7Version.v25, 13, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 13, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 13, HL7Repeat.False, HL7Required.True,"DTM")]
  	    [HL7Field(HL7Version.v27, 13, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM EffectiveDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("14 Expiration Date",14)]
  	    [HL7Field(HL7Version.v25, 14, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 14, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 14, HL7Repeat.False, HL7Required.True,"DTM")]
  	    [HL7Field(HL7Version.v27, 14, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM ExpirationDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("15 Expiration Reason",15)]
  	    [HL7Field(HL7Version.v26, 15, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 15, HL7Repeat.False, HL7Required.True,"CWE")]
		[AddressExpirationReason]
	    public CWE ExpirationReason {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("16 Temporary Indicator",16)]
  	    [HL7Field(HL7Version.v26, 16, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 16, HL7Repeat.False, HL7Required.True,"ID")]
		[YesnoIndicator]
	    public ID TemporaryIndicator {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("17 Bad Address Indicator",17)]
  	    [HL7Field(HL7Version.v26, 17, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 17, HL7Repeat.False, HL7Required.True,"ID")]
		[YesnoIndicator]
	    public ID BadAddressIndicator {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("18 Address Usage",18)]
  	    [HL7Field(HL7Version.v26, 18, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 18, HL7Repeat.False, HL7Required.True,"ID")]
		[AddressUsage]
	    public ID AddressUsage {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("19 Addressee",19)]
  	    [HL7Field(HL7Version.v26, 19, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 19, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST Addressee {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("20 Comment",20)]
  	    [HL7Field(HL7Version.v26, 20, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 20, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST Comment {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("21 Preference Order",21)]
  	    [HL7Field(HL7Version.v26, 21, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v27, 21, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM PreferenceOrder {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("22 Protection Code",22)]
  	    [HL7Field(HL7Version.v26, 22, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 22, HL7Repeat.False, HL7Required.True,"CWE")]
		[ProtectionCode]
	    public CWE ProtectionCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("23 Address Identifier",23)]
  	    [HL7Field(HL7Version.v26, 23, HL7Repeat.False, HL7Required.True,"EI")]
  	    [HL7Field(HL7Version.v27, 23, HL7Repeat.False, HL7Required.True,"EI")]
	    public EI AddressIdentifier {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
			dataTypeParts.Add(GetER7TextForDataPart(StreetAddress, options));
		    dataTypeParts.Add(OtherDesignation);
		    dataTypeParts.Add(City);
		    dataTypeParts.Add(StateorProvince);
		    dataTypeParts.Add(ZiporPostalCode);
		    dataTypeParts.Add(Country);
		    dataTypeParts.Add(AddressType);
		    dataTypeParts.Add(OtherGeographicDesignation);
			dataTypeParts.Add(GetER7TextForDataPart(CountyParishCode, options));
			dataTypeParts.Add(GetER7TextForDataPart(CensusTract, options));
		    dataTypeParts.Add(AddressRepresentationCode);
			dataTypeParts.Add(GetER7TextForDataPart(AddressValidityRange, options));
			dataTypeParts.Add(GetER7TextForDataPart(EffectiveDate, options));
			dataTypeParts.Add(GetER7TextForDataPart(ExpirationDate, options));
			dataTypeParts.Add(GetER7TextForDataPart(ExpirationReason, options));
		    dataTypeParts.Add(TemporaryIndicator);
		    dataTypeParts.Add(BadAddressIndicator);
		    dataTypeParts.Add(AddressUsage);
		    dataTypeParts.Add(Addressee);
		    dataTypeParts.Add(Comment);
			dataTypeParts.Add(GetER7TextForDataPart(PreferenceOrder, options));
			dataTypeParts.Add(GetER7TextForDataPart(ProtectionCode, options));
			dataTypeParts.Add(GetER7TextForDataPart(AddressIdentifier, options));
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

